﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;

namespace QL_BenXe
{
    public partial class TimKiemKhachHang : Form
    {
        public TimKiemKhachHang()
        {
            InitializeComponent();
        }

        public delegate void GetString(String MyString);
        public GetString Get_TenKhachHang;
        public GetString Get_MaKhachHang;

        private void TimKiemKhachHang_Load(object sender, EventArgs e)
        {

        }

        private void btn_TimKiem_Click(object sender, EventArgs e)
        {
            List<KhachHang> list=KhachHangBUS.Search(txt_TimKiem.Text);
            dtg_TimKiem.DataSource = list;
        }

        private void txt_TimKiem_TextChanged(object sender, EventArgs e)
        {
            List<KhachHang> list = KhachHangBUS.Search(txt_TimKiem.Text);
            dtg_TimKiem.DataSource = list;
        }

        private void dtg_TimKiem_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            String str = dtg_TimKiem.CurrentRow.Cells[1].Value.ToString();
            String str2 = dtg_TimKiem.CurrentRow.Cells[0].Value.ToString();
            if (Get_TenKhachHang != null)
            {
                Get_TenKhachHang(str);
                Get_MaKhachHang(str2);
            }
            this.Close();
        }
    }
}
